home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / xampp-win32-1.6.5-installer.exe / htdocs / xampp / mingswf.php < prev    next >
Encoding:
PHP Script  |  2007-12-20  |  2.4 KB  |  88 lines

  1. <?php
  2.     // Copyright (C) 2002/2003 Kai Seidler <oswald@apachefriends.org>
  3.     //
  4.     // This program is free software; you can redistribute it and/or modify
  5.     // it under the terms of the GNU General Public License as published by
  6.     // the Free Software Foundation; either version 2 of the License, or
  7.     // (at your option) any later version.
  8.     //
  9.     // This program is distributed in the hope that it will be useful,
  10.     // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     // GNU General Public License for more details.
  13.     //
  14.     // You should have received a copy of the GNU General Public License
  15.     // along with this program; if not, write to the Free Software
  16.     // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.     //
  18.  
  19.     $f = new SWFFont("AnkeCalligraph.fdb");
  20.  
  21.     $m = new SWFMovie();
  22.     $m->setRate(24.0);
  23.     $m->setDimension(520, 320);
  24.     $m->setBackground(251, 121, 34);
  25.  
  26.     // This functions was based on the example from
  27.     // http://ming.sourceforge.net/examples/animation.html
  28.  
  29.     function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) {
  30.         global $f, $m;
  31.  
  32.         $t = new SWFText();
  33.         $t->setFont($f);
  34.         $t->setColor($r, $g, $b, $a);
  35.         $t->setHeight(96);
  36.         $t->moveTo(-($t->getWidth($string)) / 2, 32);
  37.         $t->addString($string);
  38.  
  39.         $i = $m->add($t);
  40.         $i->rotateTo($rot);
  41.         $i->moveTo($x, $y);
  42.         $i->scale($scale, $scale);
  43.  
  44.         return $i;
  45.     }
  46.  
  47.     $colorr[1] = 255 * 0.85;
  48.     $colorg[1] = 255 * 0.85;
  49.     $colorb[1] = 255 * 0.85;
  50.  
  51.     $colorr[2] = 255 * 0.9;
  52.     $colorg[2] = 255 * 0.9;
  53.     $colorb[2] = 255 * 0.9;
  54.  
  55.     $colorr[3] = 255 * 0.95;
  56.     $colorg[3] = 255 * 0.95;
  57.     $colorb[3] = 255 * 0.95;
  58.  
  59.     $colorr[4] = 255;
  60.     $colorg[4] = 255;
  61.     $colorb[4] = 255;
  62.  
  63.     $c = 1;
  64.     $anz = 4;
  65.     $step = 4 / $anz;
  66.  
  67.     for ($i = 0; $i < $anz; $i += 1) {
  68.         $x = 1040;
  69.         $y = 50 + $i * 30;
  70.         $size = ($i / 5 + 0.2);
  71.         $t[$i] = text($colorr[$c], $colorg[$c], $colorb[$c], 0xff, 0, $x, $y, $size, $_GET['text']);
  72.         $c += $step;
  73.     }
  74.  
  75.     $frames = 300;
  76.     for ($j = 0; $j < $frames; $j++) {
  77.         for ($i = 0; $i < $anz; $i++) {
  78.             $t[$i]->moveTo(260 + round(sin($j / $frames * 2 * pi() + $i) * (50 + 50 * ($i + 1))), 160 + round(sin($j / $frames * 4 * pi() + $i) * (20 + 20 * ($i + 1))));
  79.             $t[$i]->rotateTo(round(sin($j / $frames * 2 * pi() + $i / 10) * 360));
  80.         }
  81.         $m->nextFrame();
  82.     }
  83.  
  84.     header('Content-Type: application/x-shockwave-flash');
  85.     $m->output(0);
  86.     exit;
  87. ?>
  88.